package com.spring.dao;

import com.spring.entity.Area;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository("accountDao")
public class AccountDaoImpl implements AccountDao {


    @Autowired
    @Qualifier("query")
    QueryRunner queryRunner;


    public List<Area> queryArea() {
        try {
            return queryRunner.query("select * from tb_area", new BeanListHandler<Area>(Area.class));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }

    public Area queryAreaById(int areaId) {
        return null;
    }

    public int insertArea(Area area) {
        return 0;
    }

    public int updateArea(Area area) {
        return 0;
    }

    public int deleteArea(int areaId) {
        return 0;
    }
}
